<template lang="html">
  <div class="box">
      <div class="header">
          <el-form class="filterCondition demo-form-inline" ref="form"  :inline="true" label-width="80px">
              <el-input placeholder="请输入运营商名称" v-model="keyword" style="width: 420px;">
                <el-button slot="append" style="width: 120px;" @click="search()">搜索</el-button>
              </el-input>
          </el-form>
      </div>


      <div class="body" v-loading="loading">
            <el-table :data="tableData.list" border style="width: 100%">
                <el-table-column label="运营商名称" prop="company" align="center" width=""></el-table-column>
                <el-table-column label="地区" align="center" width="">
                    <template slot-scope="scope">
                        <p v-for="i,k in scope.row.area" :key="k">{{i.city}}-{{i.county}}</p>
                    </template>
                </el-table-column>
                <el-table-column label="联系电话" prop="phone" align="center" width=""></el-table-column>
                <el-table-column label="负责人" prop="leader" align="center" width=""></el-table-column>
                <el-table-column label="申请时间" prop="create_time" align="center" width=""></el-table-column>
                <el-table-column label="取消理由" align="center" width="">
                    <template slot-scope="scope">
                        <el-popover  placement="left" trigger="click">
                            <p>{{scope.row.reason}}</p>
                            <el-button type="primary" size="mini" plain slot="reference">查看详情</el-button>
                        </el-popover>
                    </template>
                </el-table-column>
                <el-table-column label="物料交接" prop="profit" align="center" width="">
                    <template slot-scope="scope">
                      <el-button type="primary" size="mini" plain @click="popup(scope.row.detail)">查看详情</el-button>
                    </template>
                </el-table-column>
                <el-table-column label="通过时间" prop="audit_time" align="center" width=""></el-table-column>
            </el-table>
      </div>
      <div class="page_box">
          <el-pagination class="page" layout="prev, pager, next"
            @current-change="onpage" :current-page="currentPage" :page-count='tableData.rows' >
          </el-pagination>
      </div>

      <el-dialog :visible.sync="dialogVisible">
        <el-table :data="gritData">
            <el-table-column width="" align="center" property="name" label="物料名称"></el-table-column>
            <el-table-column width="" align="center" property="ration" label="原有期初配给"></el-table-column>
            <el-table-column width="" align="center" property="materiel_stock" label="原剩余库存"></el-table-column>
            <el-table-column width="" align="center" property="supplement" label="需补充数量"></el-table-column>
        </el-table>
      </el-dialog>
  </div>
</template>

<script>
export default {
  data(){
    return {
        token: this.$store.state.user.token3,
        // 所有数据
        tableData: [],
        gritData:[],
        keyword: '',
        currentPage:1,
        dialogVisible:false,
        loading: false
    }
  },
  created(){
    this.cancelList()
  },
  methods:{
    search(){
      this.cancelList()
    },
    cancelList(page=1){
      this.currentPage = page;
      this.$http3.cancelList1({
        token: this.token,
        key: this.keyword,
        page:page
      }).then(res=>{
        this.tableData =
        res.data.code == 1?
        res.data.data: []
      })
    },
    popup(data){
      this.dialogVisible = true;
      this.gritData = data;
    },
    onpage(p){
      this.cancelList(p)
    },
  }
}
</script>

<style lang="css" scoped>
@import "../../my-style/app.css";
/deep/ .el-input-group__append, .el-input-group__prepend{
  background-color: #3498E9;
  border: none;
  color: white;
}
.preview-img{
  display: block;
  width: 100%;
  height: 30px;
}
.header{
  margin-bottom: 10px
}
.page_box{
  text-align: center;
}

</style>
